package com.suitsoft.ut.service.base;

import java.util.Date;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.suitsoft.ut.commons.UserHolder;
import com.suitsoft.ut.dao.base.StudentDao;
import com.suitsoft.ut.entity.account.User;
import com.suitsoft.ut.entity.base.Student;

/**
 * 学生 服务层类
 *@author Suineg
 */
@Service
@Transactional
public class StudentManager {
	/** 日志输出对象 */
	protected final Logger logger = LoggerFactory.getLogger(getClass());
	@Autowired
	private StudentDao dao;
	
	
	public Student findByUser(Long id){
		return dao.findByUser(id);
	}
	
	public void save(Student student){
		User user = new User();
		user.setId(UserHolder.getLoginUser().getId());
		student.setLastDate(new Date());
		student.setLastUser(user);
		dao.save(student);
	}

	public Student get(Long id){
		return dao.get(id);
	}
	public List<Student> findByNoThesis(){
		return dao.findByNothesis();
	}
	
	public Student findByStudentNo(String no){
		return dao.findUniqueBy("studentNo", no);
	}
	
	public List<Student> get(List<Long> ids){
		return dao.get(ids);
	}
}

